import java.io.File

fun main() {
    var file = File("E://i have a dream.txt")
    val result = file.run { readText().contains("great") }
    println(result)

    val result02 = "the people's republic of china.".run { ::isLong };
    println(result02)

    //run返回lambda表达式结果
    "the people's republic of china."
        .run { ::isLong }
        .run { ::showMessage }
        .run (::println)


}

fun isLong(name:String) = name.length >= 10

fun showMessage(isLong:Boolean):String{
    return if(isLong){
        "name is too long."
    } else {
        "please rename."
    }
}